package com.sz.biz.common.customer.service;

import com.sz.biz.common.customer.entity.CusBusinessContacts;
import com.sz.biz.common.customer.dto.CusBusinessContactsDto;
import com.sz.common.base.dto.CodeNameDto;
import com.sz.common.base.dto.QResultDto;

import java.util.List;

/**
 * Created by xutao on 17/4/21.
 */
public interface CustomerBusinessContactsService {

    /**
     * 新增客户业务联系人信息
     *
     * @param entry 新增的实体
     * @return
     */
    int save(CusBusinessContacts entry);

    /**
     * 凭借id修改客户业务联系人信息
     *
     * @param entry
     * @return
     */
    int updateById(CusBusinessContacts entry);

    /**
     * 删除客户业务联系人信息
     *
     * @param ids
     * @return
     */
    void delete(List<Integer> ids);

    /**
     * 搜索客户业务联系人信息
     *
     * @param
     * @return
     */
    QResultDto getContactList(String q, String sortName, boolean isAsc, int pageIndex, int pageSize, int refCustomerId);

    /**
     * 凭借customerid查找联系人信息
     */
    List<CusBusinessContacts> findByCustomerId(Integer refCustomerId);

    /**
     * 凭借id查找联系人信息
     */
    CusBusinessContactsDto findById(Integer id);

    /**
     * 检查业务联系人是否重复 true:已经添加过 fasle:未添加过
     */
    Boolean checkContactsExist(CusBusinessContacts entry);

    /**
     * 获取所有的业务联系人组信息
     */
    List<CodeNameDto> getBusinessContactsGroupList();

    /**
     * @param refCustomerId 账户ID
     * @param groupCode     public static final String CUS_BUS_CONTACT_SYS_GROUP_SALES = "SYS-GROUP-SALES";//销售
     *                      public static final String CUS_BUS_CONTACT_SYS_GROUP_FD = "SYS-GROUP-FD";//财务
     *                      public static final String CUS_BUS_CONTACT_SYS_GROUP_CSD = "SYS-GROUP-CSD";//客服
     * @return
     */
    List<CusBusinessContacts> findByCustomerIdAndGroupCode(Integer refCustomerId, String groupCode);

    /**
     * 根据客户的账户id、业务组，来获取一个随机的客服人员
     *
     * @param refCustomerId 客户的账户id
     * @param groupCode     public static final String CUS_BUS_CONTACT_SYS_GROUP_SALES = "SYS-GROUP-SALES";//销售
     *                      public static final String CUS_BUS_CONTACT_SYS_GROUP_FD = "SYS-GROUP-FD";//财务
     *                      public static final String CUS_BUS_CONTACT_SYS_GROUP_CSD = "SYS-GROUP-CSD";//客服
     * @return 一个随机的客服，如果没有客服人员则返回0;
     */
    int findRandomBussIdByCustomerIdAndGroupCode(Integer refCustomerId, String groupCode);
}
